﻿using System;
using System.IO;
using com.bodurov.SessionRecovery.Tests.Utils;
using NUnit.Framework;

namespace com.bodurov.SessionRecovery.Tests
{
    [TestFixture]
    public class ConfigurationTestFixture
    {
        [Test]
        public void DateFormattingTest()
        {
            var date = DateTime.Now;
            var dateAsStr = TestHolder.Config.DateToString(date);
            var dateSecGen = TestHolder.Config.StringToDate(dateAsStr);
            var dateAsStrSecGen = TestHolder.Config.DateToString(dateSecGen);

            Assert.AreEqual(dateAsStr, dateAsStrSecGen);
            Assert.AreEqual(date, dateSecGen);

        }

        [Test]
        public void UnityFrameworkConfigurationChangeTest()
        {
            var dir = new DirectoryInfo("../../SavedSessionsFolder");
            Assert.AreEqual(dir.FullName, TestHolder.Config.SessionFilesFolder, 
                            "The configuration class defined in App.config file was not used");
        }
        
    }
}
